function [ select_feature_index ] = FLD_M( class_C)
% fisher liner distinguesh of features for multiple classes
   [icc, class_number] = size(class_C);
   [class1_samples_number, feature_number1] = size(class_C{1});
   samples = class1_samples_number;
   for i = 2 : 1 : class_number
        [class2_samples_number, feature_number2] = size(class_C{i});
        if feature_number1 ~= feature_number2
            return
        end
        samples = min(samples, class2_samples_number);
   end
   
   feature_number = feature_number1;
   % sample data
   for i = 1 : 1 :  class_number
       class = class_C{i};
       sample_class = class(1 : samples, :);
       mean_class = repmat(mean(sample_class), samples,1); 
       c_sample_class = sample_class - mean_class;
       class_C{i} = c_sample_class;
   end
   
%    % mean data
%    mean_class1 = repmat(mean(samples_class1), samples,1);
%    mean_class2 = repmat(mean(samples_class2), samples,1);
%    
%    %centralized
%    c_sample_class1 = samples_class1 - mean_class1;
%    c_sample_class2 = samples_class2 - mean_class2;
   
   %select feature
   % max_rate = max(max_rate , add_rate, single)
   max_rate = 0;
   use_index = [];
   for i = 1:1:class_number
        calculate_class{i} = [];
   end
   for index = [1:1:feature_number]
       % add rate
       tmp_index = [use_index index];
       len_index = length(tmp_index);
       
        for j = 1 : 1 : class_number
            class_data = [];
            for i = 1 : 1 : len_index
                
                c_sample_class = class_C{j};
                class_data = [class_data c_sample_class(: , tmp_index(i))];
            end
            calculate_class{j} = class_data;
        end
        s_b = 0;
        s_i = 0;
        for j = 1 : 1 : class_number
            class1_data = calculate_class{j};
            for i = j+1 : 1 : class_number  
                class2_data = calculate_class{i};
                s_b = s_b + sum(sum((class1_data - class2_data)'*(class1_data - class2_data)))';
            end
            s_i = s_i + sum(sum((class1_data)'*(class1_data)))';
        end
       a_rate = s_b / s_i;
       
       % single rate
       for j = 1 : 1 : class_number          
            c_sample_class = class_C{j};
            class_data = [];
            class_data = [c_sample_class(: , index)];     
            calculate_class{j} = class_data;
        end
        s_b = 0;
        s_i = 0;
        
        for j = 1 : 1 : class_number
            class1_data = calculate_class{j};
            for i = j+1 : 1 : class_number  
                class2_data = calculate_class{i};
                s_b = s_b + sum(sum((class1_data - class2_data)'*(class1_data - class2_data)))';
            end
            s_i = s_i + sum(sum((class1_data)'*(class1_data)))';
        end
       s_rate = s_b / s_i;
       
       %compare
       if s_rate > a_rate
           if s_rate > max_rate
               max_rate = s_rate;
               use_index = [index];
           end
       else
           if a_rate > max_rate
               max_rate = a_rate;
               use_index = [use_index index];
           end
       end  
       
       fprintf('%d %6f %6f %6f %d\n',index,a_rate,s_rate,max_rate,use_index);
   end
   select_feature_index = use_index;
end

